package visiopuce.objets;

import java.util.ArrayList;
import java.util.Date;

public class Analyse {

	private Date dateTechnique;
	private Integer idAnalyse;
	private Prelevement prelevement;
	private String raisonUrgent;
	private TypeAnalyse typeAnalyse;
	private Integer ufExec;
	private boolean urgent;
	private Utilisateur technicienne;
	private ArrayList<Champ> champs;

	public ArrayList<Champ> getChamps() {
		return champs;
	}

	public void setChamps(ArrayList<Champ> champs) {
		this.champs = champs;
	}

	public boolean removeChamp(Champ champ) {
		return champs.remove(champ);
	}

	public Analyse() {
	}

	public boolean addChamp(Champ champ) {
		return champs.add(champ);
	}

	public Analyse copier() {
		Analyse ana = new Analyse();

		ana.setPrelevement(prelevement);

		ana.setRaisonUrgent(raisonUrgent);

		ana.setUrgent(urgent);
		return ana;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Analyse other = (Analyse) obj;
		if (idAnalyse == null) {
			if (other.idAnalyse != null)
				return false;
		} else if (!idAnalyse.equals(other.idAnalyse))
			return false;
		return true;
	}

	public Date getDateTechnique() {
		return dateTechnique;
	}

	public Integer getIdAnalyse() {
		return idAnalyse;
	}



	public Prelevement getPrelevement() {
		return prelevement;
	}



	public String getRaisonUrgent() {
		return raisonUrgent;
	}

	public Utilisateur getTechnicienne() {
		return technicienne;
	}

	public TypeAnalyse getTypeAnalyse() {
		return typeAnalyse;
	}

	public Integer getUfExec() {
		return ufExec;
	}



	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((idAnalyse == null) ? 0 : idAnalyse.hashCode());
		return result;
	}

	public boolean isUrgent() {
		return urgent;
	}

	public void setDateTechnique(Date dateTechnique) {
		this.dateTechnique = dateTechnique;
	}

	public void setIdAnalyse(Integer idAnalyse) {
		this.idAnalyse = idAnalyse;
	}

	

	public void setPrelevement(Prelevement prelevement) {
		this.prelevement = prelevement;
	}

	

	public void setRaisonUrgent(String raisonUrgent) {
		this.raisonUrgent = raisonUrgent;
	}

	public void setTechnicienne(Utilisateur technicienne) {
		this.technicienne = technicienne;
	}

	public void setTypeAnalyse(TypeAnalyse typeAnalyse) {
		this.typeAnalyse = typeAnalyse;
	}

	public void setUfExec(Integer ufExec) {
		this.ufExec = ufExec;
	}



	public void setUrgent(boolean urgent) {
		this.urgent = urgent;
	}

	@Override
	public String toString() {
		String chaine = "Analyse [idAnalyse=" + idAnalyse;
		if (prelevement != null) {
			chaine += ", idPrelevement=" + prelevement.getIdPrelevement();
		}
		
		if (typeAnalyse != null) {
			chaine += ", idTypeAnalyse=" + typeAnalyse.getIdTypeAnalyse();
		}
		
		if (technicienne != null) {
			chaine += ", idTechnicienne=" + technicienne.getIdUtilisateur();
		}
		chaine += ", raisonUrgent=" + raisonUrgent + ", urgent=" + urgent + ", dateTechnique=" + dateTechnique + ", ufExec=" + ufExec  + "]";
		return chaine;
	}
}
